/*
 ============================================================================
 Name		: YuebaoTaskListboxItem.h
 Author	  : wangchao
 Version	 : 1.0
 Copyright   :
 Description : YuebaoTaskListboxItem declaration
 ============================================================================
 */

#ifndef YuebaoTaskListboxItem_H
#define YuebaoTaskListboxItem_H

// INCLUDES
#include <e32std.h>
#include <e32base.h>
#include "fFramework.h"
#include "fListbox.h"
#include "YuebaoSplashString.h"

class YuebaoDownloadTask;

// CLASS DECLARATION

/**
 *  YuebaoTaskListboxItem
 *
 */
class YuebaoTaskListboxItem : public fListBoxItem
{
public:
    // Constructors and destructor

    /**
     * Destructor.
     */
    ~YuebaoTaskListboxItem();

    /**
     * Two-phased constructor.
     */
    static YuebaoTaskListboxItem
    * NewL( fEngine* aFramework, fImage* background, RPointerArray< fImage >* icons, YuebaoDownloadTask* task );

    /**
     * Two-phased constructor.
     */
    static YuebaoTaskListboxItem* NewLC( fEngine* aFramework, fImage* background, RPointerArray< fImage >* icons, YuebaoDownloadTask* task );

private:

    /**
     * Constructor for performing 1st stage construction
     */
    YuebaoTaskListboxItem();

    /**
     * EPOC default constructor for performing 2nd stage construction
     */
    void ConstructL( fEngine* aFramework, fImage* background, RPointerArray< fImage >* icons, YuebaoDownloadTask* task );
public:
    void RenderFrame();
    TInt HandleMouse( fMouseEvent /*nType*/, TPoint /*sPoint*/)
    {
        return 0;
    }
protected:
    void DrawItem( bool hilite, int x, int y );
protected:
    int TextL()
    {
        return Left() + 8;
    }

    int TextT()
    {
        int height = Height();
        int font_height = _font->HeightInPixels();
        return Top() + ( ( height - _font->HeightInPixels() ) >> 1 );
    }

protected:
    CFont* _font;
protected:
    int DrawNormal( int x, int y )
    {
        DrawItem( false, x, y );
        return 0;
    }
    int DrawHilite( int x, int y )
    {
        DrawItem( true, x, y );
        return 0;
    }
public:
    int ItemHeight();
public:
    RPointerArray< fImage >* _icons;
    YuebaoDownloadTask* _task;
    DrawableString _taskName;
    bool _layouted;
public:
    //fImage* _curseIcon;
};

#endif // YuebaoTaskListboxItem_H
